package com.education.welco.mapper;

import com.education.welco.pojo.OrderPaper;
import com.education.welco.pojo.TClass;
import com.education.welco.pojo.vo.OrderPaperAppVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;


/**
 * 试卷表 数据层
 *
 * @author d
 * @date 2021-03-04 15:45:18
 */
@Repository
public interface OrderPaperMapper {

    //查询试卷表信息
    public OrderPaper selectOrderPaperById(Integer id);

    // 查询试卷表列表
    public List<OrderPaper> selectOrderPaperList(OrderPaper orderPaper);

    // 新增试卷表
    public int insertOrderPaper(OrderPaper orderPaper);
    //public int insertPaperTest(OrderPaperVo orderPaper);

    //修改试卷表
    public int updateOrderPaper(OrderPaper orderPaper);

    //删除试卷表
    public int deleteOrderPaperById(Integer id);

    // 批量删除试卷表
    public int deleteOrderPaperByIds(String[] ids);

    public List<OrderPaper> selectOrderPaperList1();

    List<OrderPaper> selectOrderPaperStuList(OrderPaper orderPaper);

    List<Integer> selectOrderPaperStuListAll(OrderPaper orderPaper);

    List<Integer> selectOrderPaperStuListSome(@Param("courseId") String courseId, @Param("stuId") Integer stuId);

    List<OrderPaper> selectOrderPaperStuListOther(@Param("list") List<Integer> other);

    List<OrderPaper> paperListByTeacher(@Param("teaId") Integer teaId, @Param("paperName") String paperName, @Param("examStatus") Integer examStatus);

    List<TClass> selectClassBypaperId(@Param("paperId") Integer paperId);

    List<TClass> selectClassByTopCatalogId(@Param("topCatalogId") Integer topCatalogId);

    int selectWaitStudentPaperNumByTeaId(@Param("teaId") String teaId);

    /**
     * 根据二级目录查试卷(查询老师准备的某门课程下的全部试题列表)
     *
     * @param twoIntList 二级目录列表
     * @return
     */
    List<Integer> selectpaperIdByLessonIdTwo(@Param("twoIntList") List<Integer> twoIntList);

    /**
     * 班级和课程下试卷的中间关联表擦插入数据
     *
     * @param classId
     * @param paperIdList
     * @param teaId
     * @return
     */
    int insertClassPaper(@Param("classId") Integer classId, @Param("paperIdList") List<Integer> paperIdList, @Param("teaId") Integer teaId);

    /**
     * 班级和课程下试卷的中间关联表擦插入数据
     *
     * @param classIdList 班级id集合
     * @param paperId     试卷id
     * @param teaId       老师用户id
     * @return
     */
    int insertClassPaperTwo(@Param("classIdList") List<Integer> classIdList, @Param("paperId") Integer paperId, @Param("teaId") String teaId);

    /**
     * 排除重复数据(根据老师id和班级id查找classpaper表得到paper列表)
     *
     * @param classId
     * @param teaId
     * @return
     */
    List<Integer> queryPaperIdByClassIdAndTeaIdFromClassPaper(@Param("classId") Integer classId, @Param("teaId") Integer teaId);

    List<OrderPaperAppVO> selectPaperListForTea(@Param("teaId") Integer teaId);

    /**
     * 删除class_paper的关联记录 依据paperId
     * @param paperId
     * @return
     */
    int deleteClassPaperByPaperId(@Param("paperId") int paperId);
}